package com.weihui.jxc.service.impl;

import java.util.List;

import com.weihui.jxc.dao.BaseDao;
import com.weihui.jxc.dao.ProviderDao;
import com.weihui.jxc.model.Provider;
import com.weihui.jxc.service.ProviderService;
/**
 * 供应商业务实现类
 * @author xiaowei
 *
 */
public class ProviderServiceImpl implements ProviderService {
    private BaseDao<Provider> providerDao;
    /**
     * 添加供应商信息
     */
	@Override
	public boolean addProvider(Provider provider) {
		providerDao = new ProviderDao();
		return providerDao.save(provider);
	}
    /**
     * 动态生成供应商编号
     */
	@Override
	public String getProviderId() {
		providerDao = new ProviderDao();
		return providerDao.getId();
	}
    /**
     * 查询供应商信息
     */
	@Override
	public List<Provider> findProviders(Provider p) {
		providerDao = new ProviderDao();
		return providerDao.query(p);
	}
    /**
     * 修改供应商信息
     */
	@Override
	public boolean updateProvider(Provider p) {
		providerDao = new ProviderDao();
		return providerDao.update(p);
	}
    /**
     * 根据供应商编号实现删除
     */
	@Override
	public boolean updateProvider(String id, Integer available) {
		providerDao = new ProviderDao();
		return providerDao.update(id, available);
	}

}